package cn.rdq.iknessplatform.service.impl;

import cn.rdq.api.po.Episode;
import cn.rdq.dao.EpisodeMapper;
import cn.rdq.iknessplatform.service.EpisodeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class EpisodeServiceImpl extends ServiceImpl<EpisodeMapper, Episode> implements EpisodeService {
    @Override
    public List<Episode> listByDramaId(Long dramaId) {
        QueryWrapper<Episode> wrapper = new QueryWrapper<>();
        wrapper.select("id", "name")
                .eq("drama_id", dramaId)
                .orderByAsc("length(name)")
                .orderByAsc("name");
        return list(wrapper);
    }

}
